<script setup lang="ts">
import useBaseModel from '@/composables/system/role/useBaseModel';
import useDialog from '@/hooks/useDialog';
import SysDialog from '@/components/SysDialog/index.vue';
import useRoleAddAndEdit from '@/composables/system/role/useRoleAddAndEdit';
import { watch } from 'fs';

// 基础数据
const { addModel, rules } = useBaseModel()

// 弹框
const { dialog, onShow, onClose } = useDialog()

// 注册事件
const emit = defineEmits(['save'])

const { onConfirm, show, addRoleForm } = useRoleAddAndEdit(dialog, onShow, onClose, addModel, emit)

// 暴露方法给外部使用
defineExpose({
    show
})

// defineProps(['roleOption'])

</script>
<template>
    <SysDialog :title="dialog.title" :width="dialog.width" :height="150" :visible="dialog.visible" @onClose="onClose"
        @onConfirm="onConfirm">
        <template v-slot:content>
            <el-form :model="addModel" ref="addRoleForm" :rules="rules" label-width="80px">
                <el-form-item prop="role_name" label="角色名称">
                    <el-input v-model="addModel.role_name"></el-input>
                </el-form-item>
                <el-form-item prop="status" label="状态">
                    <el-radio-group v-model="addModel.status">
                        <el-radio label="1">正常</el-radio>
                        <el-radio label="0">停用</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="角色备注">
                    <el-input v-model="addModel.remark"></el-input>
                </el-form-item>
            </el-form>
        </template>
    </SysDialog>
</template>
<style lang="scss" scoped>
</style>